var express = require('express');
var router = express.Router();
var casual = require('casual');

var codes = [
    {code:200,message:'操作成功'},
    {code:601,message:'操作失败'},
    {code:602,message:'参数不合法或不正确'},
    {code:611,message:'拿不到cookies'},
    {code:612,message:'拿不到指定ticket那个cookie'},
    {code:613,message:'用户未登录、或登录超时'}
];
var checkbalancestate = [
    {body:true,code:200,message:'操作成功'},
    {body:false,code:200,message:'操作成功'},
    {body:false,code:601,message:'操作失败'},
    {body:false,code:602,message:'参数不合法或不正确'},
    {body:false,code:611,message:'拿不到cookies'},
    {body:false,code:612,message:'拿不到指定ticket那个cookie'},
    {body:false,code:613,message:'用户未登录、或登录超时'}
];
// casual.random_element
// casual.define('checkbalancestate', function() {
//     return {
//         "body":false,
//         "code":"200",
//         "message":"operate successfully"
//     };
// });

var payload = casual.random_element(checkbalancestate);

router.post('/api/checkbalancestate', function (req, res) {
    res.json(payload);
})
// var paylod = {"body":false,"code":"200","message":"operate successfully"};

module.exports = router;
